package org.ffsky.jsplugin;

import java.util.HashSet;
import java.util.Set;

class JsPluginManagerImpl extends JsPluginManager {

    private Set<Class<? extends JsPlugin>> plugins = new HashSet();

    protected JsPluginManagerImpl() {
        super();
    }

    public void register(Class<? extends JsPlugin> cls) {
        if(!plugins.contains(cls)){
            plugins.add(cls);
        }
    }
    public void unregister(String name) {
        plugins.remove(name);
    }

    @Override
    public Set<Class<? extends JsPlugin>> listJsPlugin() {
        Set<Class<? extends JsPlugin>> copy = new HashSet(plugins);
        return copy;
    }

    public void clearPlugin() {
        plugins.clear();
    }

    @Override
    public void dispose() {

    }
}
